<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Exportar a Word</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="../style.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
    .Estilo1 {color: #fff}
    .Estilo2 {
    font-size: 12px
    }
-->
</style>
</head> 
<script type="text/javascript">
function SetHTML(type) 
{
    document.getElementById("ver_empresas").style.display = "none"
    // Using style.display="block" instead of style.display="" leaves a carriage return
    document.getElementById(type).style.display = ""
}
</script>
<body>
<div id="bodymiddlePan">
<h2>Exportar a Word</h2> 
<FORM METHOD="POST" ACTION="MySQL_To_Excel-Word.php">
<table>
<tr>
<td>Seleciona la tabla a exportar:</td>
<td> <input type="radio" value="empresa" name="Tabla" onClick="SetHTML('type')" checked="checked">Empresas &nbsp;</td> 
<td> <input type="radio" value="usuario" name="Tabla" onClick="SetHTML('ver_empresas')">Usuarios </td>  
</tr>
<tr>
<td colspan="3"> <span id="ver_empresas" style="display:none">Ingresa la empresa que deseas listar:
                <SELECT NAME="Nomempresa">
                  <?php 
                    include "../conexion.php";
                    $connection = DBConnect();
                    $query = sprintf("SELECT * FROM empresa");
                    $result = mysql_query($query) or die ('\n error en query ' . mysql_error());
                    if (!$result) {
                        $message  = 'Solicitud invalida : ' . mysql_error() . "\n";
                        $message .= 'Solicitud completada : ' . $query;
                        die($message);
                    }  ?>
                    <OPTION VALUE="Todas">Todas</OPTION>
                    <?php 
                    while($row = mysql_fetch_assoc($result)){
                        $db_nombre=$row['nombre'];
                        echo "<OPTION VALUE=\"";
                        echo $db_nombre;
                        echo "\">";
                        echo $db_nombre;
                    }                   
                    DBClose($connection);
                  ?>
                </SELECT>
                </span> </td>
</tr>                                                    
<input type="hidden" name="Formato" value="1">
<tr>                                    
<td>     
<input  type="submit" align="center" name="Exportar" value="Ok" class="botton">
</td>
</tr>
</table>
</form>  


</div>
</body>
</html>